package com.example.zhongshuishi.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * @author 学生表实体类
 * @version 1.0
 * @description TODO
 * @date 2025/3/29 10:25
 */
@Component
public class CustomerUserDetails implements UserDetails {

    private String id;

    //  @NotBlank(message = "学生姓名不能为空")
    private String name;
    private String weixin;

    // @NotBlank(message = "学生身份证号不能为空")
    // @Pattern(regexp = "^\\d{15}|\\d{18}$", message = "学生身份证号格式不正确")
    private String idnumber;

    // @NotBlank(message = "工作地点不能为空")
    private String workplace;

    //@NotBlank(message = "学生电话不能为空")
    // @Pattern(regexp = "^1[3-9]\\d{9}$", message = "学生电话格式不正确")
    private String phone;

    // @NotBlank(message = "教师不能为空")
    private String teacherName;

    // @NotBlank(message = "地区不能为空")
    private String region;

    //  @NotBlank(message = "城市不能为空")
    private String city;

    private String photo;

    private String deleflag;

    //  @Email(message = "邮箱格式不正确")
    private String email;
    private String teacherId;

    private Integer parentId;
    private Integer parentLevel;

    //用户角色，teacher老师，student学生
    private String roleFromToken;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        GrantedAuthority grantedAuthority = new GrantedAuthority() {
            @Override
            public String getAuthority() {
                return "student";
            }
        };
        return null;
    }

    @Override
    public String getPassword() {
        return "";
    }

    @Override
    public String getUsername() {
        return "";
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWeixin() {
        return weixin;
    }

    public void setWeixin(String weixin) {
        this.weixin = weixin;
    }

    public String getIdnumber() {
        return idnumber;
    }

    public void setIdnumber(String idnumber) {
        this.idnumber = idnumber;
    }

    public String getWorkplace() {
        return workplace;
    }

    public void setWorkplace(String workplace) {
        this.workplace = workplace;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getTeacherName() {
        return teacherName;
    }

    public void setTeacherName(String teacherName) {
        this.teacherName = teacherName;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }


    public String getDeleflag() {
        return deleflag;
    }

    public void setDeleflag(String deleflag) {
        this.deleflag = deleflag;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(String teacherId) {
        this.teacherId = teacherId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getParentLevel() {
        return parentLevel;
    }

    public void setParentLevel(Integer parentLevel) {
        this.parentLevel = parentLevel;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getRoleFromToken() {
        return roleFromToken;
    }

    public void setRoleFromToken(String roleFromToken) {
        this.roleFromToken = roleFromToken;
    }
}